//
// Created by momolove on 22-12-2.
//

#ifndef UNIX_EXP_COMMON_H
#define UNIX_EXP_COMMON_H

typedef int BOOL;

#ifndef FALSE
    #define FALSE 0
#endif

#ifndef TRUE
    #define TRUE 1
#endif

#ifndef MAX
    #define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif

#ifndef print_line_helpers
#define print_line_helpers

    #include <stdio.h>
    /** Say goodbye to `\\n` in printf. */
    #define print_line(format, ...) printf(format "\n", ##__VA_ARGS__)
    /** Say goodbye to `\\n` in fprintf(stderr, ...). */
    #define print_line_stderr(format, ...) fprintf(stderr, format "\n", ##__VA_ARGS__)
    /** Print an error message to stderr and exit with provided status code. */
    #define print_error_and_exit(status, format, ...) fprintf(stderr, format "\n", ##__VA_ARGS__); exit(status)

#endif  // print_line_helpers

#endif  // UNIX_EXP_COMMON_H
